﻿#region header

//  ***************************************************************************
// *                                LICENSE
//  ***************************************************************************
//  * "Haplous" .NET Simple 2D Game Framework
//  * 
//  * Copyright © Jonathan Evans 2014-2014
//  * 
//  * This program is free software; you can redistribute it and/or
//  * modify it under the terms of the GNU General Public License
//  * as published by the Free Software Foundation; either version 2
//  * of the License, or (at your option) any later version.
//  * 
//  * This program is distributed in the hope that it will be useful,
//  * but WITHOUT ANY WARRANTY; without even the implied warranty of
//  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  * GNU General Public License for more details.
//  * 
//  * You should have received a copy of the GNU General Public License
//  * along with this program; if not, write to the Free Software
//  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//  * 
//  ***************************************************************************
//  * 
//  * Contact: opencollar@googlemail.com
//  * 
//  * Website: http://haplous.codeplex.com/
//  *
//  * NuGet:   http://www.nuget.org/packages/haplous/
//  *
//  * File:    Haplous/Ghosthunt/GhostDirector.cs
//  *
//  ***************************************************************************

#endregion

using System;

using Haplous;

namespace Ghosthunt
{
    /// <summary>
    ///     A controller that attempts to keep the ghost hugging a wall to its left or right.
    /// </summary>
    public class GhostDirector : WallHuggingDirector
    {
        /// <summary>
        ///     Initializes a new instance of the <see cref="GhostDirector" /> class.
        /// </summary>
        /// <param name="game">
        ///     The game to which the class belongs.  The <paramref name="game" /> must not be
        ///     <see langword="null" />.
        /// </param>
        /// <param name="name">
        ///     The unique name that can be used to identify this object.  The <paramref name="name" /> must not be
        ///     <see langword="null" />, empty or all whitespace.
        /// </param>
        /// <param name="actor">The Actor to control.  Must not be <see langword="null" />.</param>
        /// <param name="cue">The Cue that will be used to trigger movements.</param>
        /// <param name="initialDirection">The initial direction in which to move.</param>
        /// <param name="huggingWall">
        ///     The direction, relative to the direction of travel, to which we should always keep a wall.
        ///     Must be either <see cref="DirectionKind.Left" /> or <see cref="DirectionKind.Right" />.
        /// </param>
        /// <exception cref="ArgumentOutOfRangeException">
        ///     Only <see cref="DirectionKind.Left" /> and
        ///     <see cref="DirectionKind.Right" /> are valid values of the <paramref name="huggingWall" /> argument.
        /// </exception>
        public GhostDirector(Game game, string name, Actor actor, Cue cue, DirectionKind initialDirection, DirectionKind huggingWall) : base(game, name, actor, cue, initialDirection, huggingWall, 15)
        {}

        /// <summary>
        ///     Determines whether the specified candidate is a wall.
        /// </summary>
        /// <param name="candidate">The candidate to test.</param>
        /// <returns><see langword="true" /> if the specified candidate is wall; otherwise, <see langword="false" />.</returns>
        protected override bool IsWall(SolidGraphicBlock candidate)
        {
            return candidate is Wall;
        }
    }
}